<template>
  <div class="custom-html1" :class="{ 'select-border': isNodeSelected }" :style="styleObj">
    <!-- <img v-if="icon" :src="icon" alt="icon" class="icon" /> -->
    <ZLoadImgToBase64 v-if="icon" :imgUrl="icon" class="icon"></ZLoadImgToBase64>
    <div>
      <div class="title" :style="{ 'padding-left': icon ? '40px' : '10px' }">{{ text }}</div>
      <div class="content">{{ content }}</div>
    </div>
  </div>
</template>

<script>
import ZLoadImgToBase64 from '@/components/ZLoadImgToBase64'
export default {
  name: 'customHtml1',
  components: { ZLoadImgToBase64 },
  props: {
    text: { type: String, default: '' },
    content: { type: String, default: '' },
    icon: { type: String, default: '' },
    bgColor: { type: String, default: '' },
    isNodeSelected: { type: Boolean, default: false },
  },
  computed: {
    styleObj() {
      return {
        backgroundColor: this.isNodeSelected ? 'rgba(255, 127, 14, .3)' : this.bgColor,
        // color: this.isNodeSelected ? '#fff' : '#000',
      }
    },
  },
}
</script>

<style lang="scss" scoped>
.lf-node-selected .custom-html1,
.select-border.custom-html1 {
  border: 2px solid #ff7f0e;
}
.custom-html1 {
  background-color: #fff;
  border: 2px solid transparent;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 10px;
  height: 100%;
  box-sizing: border-box;
  position: relative;
  text-align: left;
  font-size: 14px;
  .icon {
    position: absolute;
    top: 10px;
    left: 10px;
    height: 26px;
    width: 26px;
    border-radius: 8px;
  }
  .title {
    font-weight: 700;
    line-height: 32px;
    height: 30px;
    font-size: 15px;
    overflow: hidden;
  }
  .content {
    color: #999;
    margin: 5px 0;
  }
}
</style>
